package edu.nf.relaxenjoy.common.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author zhu
 * @date 2024-12-18
 */
public class WebUtils {

    public static boolean isHttpUrl(String urls) {

        //设置正则表达式
        String regex = "^([hH][tT]{2}[pP]://|[hH][tT]{2}[pP][sS]://)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~\\\\/])+$";

        //对比
        Pattern pat = Pattern.compile(regex.trim());
        Matcher mat = pat.matcher(urls.trim());
        //判断是否匹配
        return mat.matches();
    }
}
